<?php
class Default_Model_DbTable_Ingredients extends Default_Model_DbTable_DbTableEntityAbstract
{
	protected $_primary = 'ingredient_id';
	//protected $_dependentTables = array('Default_Model_DbTable_Roles');
	
    public function init()
    {
    	$this->_name = 'ingredients';
    }
    
    public function addIngredient($data)
    {
    	$this->insert($data);
    	return $this->getAdapter()->lastInsertId();
    }
    
    public function getIngredientId($ingredient)
    {
    	$select = $this->select()
    				   ->from($this, array('ingredient_id'))
    	               ->where("ingredient_name = ?", $ingredient);
    	               
    	$result = $this->fetchRow($select);
    	//$result = $select->__toString();
    	return $result;
    }
}